import spawn from 'cross-spawn';

import { PackageManagerType } from '../initSpec/typings';

export default function addDependencies(packageManager: PackageManagerType) {
  const installCmd = packageManager === 'yarn' ? 'add' : 'install';
  spawn.sync(packageManager, [installCmd], {
    cwd: process.cwd(),
    stdio: 'inherit',
  });
  //   const installCmd = packageManager === 'yarn' ? 'add' : 'install';
  //   const legacy = packageManager === 'npm' ? '--legacy-peer-deps' : '';
  //   spawn.sync(packageManager, [installCmd, '-D', legacy].concat(deps), {
  //     cwd: process.cwd(),
  //     stdio: 'inherit',
  //   });
}
